﻿using Microsoft.AspNetCore.Authorization;

namespace Ocelot.Admin.Api.Application
{
    /// <summary>
    /// 系统服务接口
    /// </summary>
    public class SystemApiController : IDynamicApiController
    {
        private readonly ISystemService _systemService;
        public SystemApiController(ISystemService systemService)
        {
            _systemService = systemService;
        }

        /// <summary>
        /// 授权登录
        /// </summary>
        /// <param name="loginRequest">登录请求</param>
        /// <returns></returns>
        [AllowAnonymous]
        public async Task<LoginResponse> PostLoginAsync(LoginRequest loginRequest)
        {
            return await _systemService.LoginAsync(loginRequest);
        }

        public TotpResponse GetTotp()
        {
            return  _systemService.GetTotp();
        }
    }
}
